﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;

namespace CPPEI.Coolzon.Theme.Fashion.MainViewControl
{
    public partial class ZoomView
    {
        /// <summary>
        /// 触摸事件
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreviewTouchDown(TouchEventArgs e)
        {
            Point pos = e.GetTouchPoint(this).Position;
            if (pos.X > this.canvas.ActualWidth)
            {
                return;
            }
            if (_eventState == UIEventState.None && _eventType == UIEventType.None)
            {
                _eventState = UIEventState.Down;
                _eventType = UIEventType.Touch;

                _mousePos = pos;
                Down(e.GetTouchPoint(this).Position);
            }
            base.OnPreviewTouchDown(e);
        }

        protected override void OnPreviewTouchUp(TouchEventArgs e)
        {
            Point pos = e.GetTouchPoint(this).Position;
            if (pos.X > this.canvas.ActualWidth)
            {
                return;
            }
            if (_eventState == UIEventState.Down && _eventType == UIEventType.Touch)
            {
                Up(pos);
                _eventType = UIEventType.None;
                _eventState = UIEventState.None;

            }
            //canvas.Background = partBrush;
            base.OnPreviewTouchUp(e);
        }

        protected override void OnPreviewTouchMove(TouchEventArgs e)
        {
            Point pos = e.GetTouchPoint(this).Position;
            if (pos.X > this.canvas.ActualWidth)
            {
                return;
            }
            if (_eventState == UIEventState.Down && _eventType == UIEventType.Touch)
            {
                Move(pos);
            }
            base.OnPreviewTouchMove(e);
        }
    }
}
